package org.example.completed.service.impl;
import org.example.completed.domain.Pet;
import org.example.completed.mapper.PetMapper;
import org.example.completed.service.PetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PetServiceImpl implements PetService {

    private final PetMapper petMapper;

    @Autowired
    public PetServiceImpl(PetMapper petMapper) {
        this.petMapper = petMapper;
    }

    @Override
    public List<Pet> getAllPets() {
        // 调用 PetMapper 获取所有宠物
        return petMapper.getAllPets();
    }

    @Override
    public List<Pet> getPetsByName(String name) {
        // 根据名称获取宠物
        return petMapper.getPetsByName(name);
    }

    @Override
    public List<Pet> getPetsByImageUrl(String imageUrl) {
        // 根据图片URL获取宠物
        return petMapper.getPetsByImageUrl(imageUrl);
    }
}
